<!DOCTYPE html>
<html lang="en">
<head>
    <?php 
	include "includes/ketnoi.php";
	include "includes/header.php";
	?>
</head>

<body>
    <?php 
	include "includes/narbar.php";
	//truy vấn csdl
	$result = $conn->query("SELECT * FROM branch");
	//lấy tất cả các dòng
	$branchs = mysqli_fetch_all($result, MYSQLI_ASSOC);
	?>

	<div class="container">
		<h1>Tìm Việc Làm</h1>
		<div class="row clearfix list-simple">
		<?php
			//duyệt từng dòng
			foreach ($branchs as $value) {
				if($value['p_id'] == 0)
				{
					echo '<div class="col-xs-4 col-sm-3">';
					echo $value['name'];
					echo '<ul>';
					foreach ($branchs as $value2)
					{
						if($value2['p_id']==$value['id'])
							echo "<li><a href='./danhsach/{$value2['id']}'>{$value2['name']}</a></li>";
					}
					echo '</ul>
					</div>';
				}
			}
		?>
			
		</div>
	</div>
    <?php 
	include "includes/footer.php";
	?>

</body>

</html>
